/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package users.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import tracker.TrackerHelper;

/**
 *
 * @author El Desperado
 */
public class chagePasswordTagHandler extends TagSupport {
    private int userId;
    private String password;

    @Override
    public int doStartTag() throws JspException {
        return super.doStartTag();
    }

    @Override
    public int doEndTag() throws JspException {
        try {
            TrackerHelper helper = new TrackerHelper();
            helper.changeUserPassword(userId, password);
            System.out.println("Change Password Successfully! UserId: " + userId + " New Password: " + password);
        } catch (Exception e) {
            System.out.println("Error in changePasswordTagHandler: " + e.getMessage());
        }
        return EVAL_PAGE;
    }


    public void setUserId(int userId) {
        this.userId = userId;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
